//
//  HZWPictureModel.m
//  开心一刻
//
//  Created by lanou on 16/4/7.
//  Copyright © 2016年 刘洋. All rights reserved.
//

#import "HZWPictureModel.h"

@implementation HZWPictureModel
-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}
+(NSMutableArray *)creatPictureModel:(NSDictionary *)dic
{
    NSMutableArray * modelArray = [NSMutableArray array];
    
    NSArray * listArray = dic[@"list"];
    for (NSDictionary * bigDic in listArray)
    {
        HZWPictureModel * model = [[HZWPictureModel alloc]init];
        
        [model setValuesForKeysWithDictionary:bigDic];
        NSArray * tagsArray = bigDic[@"tags"];
        
        if (tagsArray.count>=4)
            {
                model.style1 = tagsArray[0][@"name"];
                model.style2 = tagsArray[1][@"name"];
                model.style3 = tagsArray[2][@"name"];
                model.style4 = tagsArray[3][@"name"];
            }
        else if (tagsArray.count >=3)
        {
            model.style1 = tagsArray[0][@"name"];
            model.style2 = tagsArray[1][@"name"];
            model.style3 = tagsArray[2][@"name"];
        }
            else if( tagsArray.count >=2)
            {
                model.style1 = tagsArray[0][@"name"];
                model.style2 = tagsArray[1][@"name"];
            }
        else if (tagsArray.count>=1)
        {
             model.style1 = tagsArray[0][@"name"];
        }
        
        NSDictionary *top_commentDic = bigDic[@"top_comment"];
        if (top_commentDic != nil)
        {
            model.betterText = top_commentDic[@"content"];
            NSDictionary * uDic = top_commentDic[@"u"];
            model.userName = uDic[@"name"];
        }
        NSDictionary * uDic = bigDic[@"u"];
        NSArray *headerArray = uDic[@"header"];
        model.aotuImage = headerArray[0];
        model.autoName = uDic[@"name"];
        
        [modelArray addObject:model];
       // NSLog(@"%@",model.share_url);
    }
    //NSLog(@"%ld",modelArray.count);
   return modelArray;
}
@end
